<%layout("/common/_layout.html"){ %>

<script type="text/javascript">
var keywordsObj = {};
var submit_btn = function(businessType,singleApi){



    if($("#opt_time").val())
        keywordsObj.opt_time = $("#opt_time").val();
	if($("#api_option").val())
		keywordsObj.api = $("#api_option").val();

	if(businessType == "singleExport"){
		keywordsObj.singleApi = singleApi;
	}

    var keywords = "";
    if(!$.isEmptyObject(keywordsObj)){
      keywords = JSON.stringify(keywordsObj);
    }
    $("#keywords").val(keywords);


	if(businessType == "search"){
		$("#list-form").submit();
	}else if(businessType == "export"){
		window.location.href = "${base}/transactionLog/exportAll?keywords="+keywords;
	}else if(businessType == "singleExport"){
		window.location.href = "${base}/transactionLog/exportOneApi?keywords="+keywords;
	}
}
</script>

<%#ajax userTable:{%>
<div class="am-cf am-padding">
	<div class="am-fl am-cf">
		<strong class="am-text-primary am-text-lg">报表中心</strong> / <small>调用接口统计</small>
	</div>
</div>

<div class="am-g">
	<%include("transaction_log_query.tpl"){}%>
	<div class="am-u-sm-12 am-u-md-12"
		style="padding: 0 1.6rem 1.6rem 1rem; margin: 0;">
		<div class="am-btn-toolbar" style="padding-left: .5rem;">
			<div class="am-btn-group am-btn-group-xs">
				<div class="am-btn-group am-btn-group-xs am-form-file">

				</div>
			</div>
		</div>
	</div>
</div>

	<div class="am-g">
		<div  style="min-height: 200px;">
			<div class="am-scrollable-horizontal">
				<table class="am-table am-table-striped am-table-hover table-main" >
					<thead>
						<tr class="am-text-nowrap">
							<th class="big-data">接口描述</th>
							<th class="big-data">接口名</th>
							<th>总共调用次数</th>
							<th>成功笔数</th>
							<th>失败笔数</th>
							<th>失败率</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
						<%for(item in pager.list!){%>
						<tr>
							<td class="big-data">${item.describes}</td>
							<td class="big-data">${item.api}</td>
							<td>${item.total}</td>
							<td>${item.success}</td>
							<td>${item.failed}</td>
							<td>
								${item.percent}%

							</td>
							<td><a href="#" onclick="submit_btn('singleExport','${item.api}')">导出失败明细</a></td>
						</tr>
						<%}%>
					</tbody>
				</table>
			</div>

			<div class="am-cf">
				<!-- 分页 -->
				<%if (pager.list.~size > 0){%>
				<div class="am-fr"><% include("/admin/common_pager.tpl"){}%></div>
				<%}else{%>
				<div class="am-kai">
					<h3>没有找到任何记录!</h3>
				</div>
				<%}%>
			</div>

		</div>
	</div>
	<div class="am-modal am-modal-no-btn" tabindex="-1" id="modal">
		<div class="am-modal-dialog">
			<div class="am-modal-hd">
				<i class="am-icon-refresh am-icon-spin"></i> <a
					href="javascript: void(0)" class="am-close am-close-spin"
					data-am-modal-close>&times;</a>
			</div>
			<div class="am-modal-bd">正在处理，请稍等...</div>
		</div>
	</div>




	<style type="text/css">
		.big-data {
			max-width: 300px;
			word-wrap:break-word;
		}
	</style>
	<%}%> <%}%>